/************************************************************************
 * @file AbstractToolBarManager.h
 * @author Ian Chen
 * @version 1.0
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details at
 * http://www.gnu.org/licenses/lgpl.html
 *
 ************************************************************************/
#ifndef ABSTRACTTOOLBARMANAGER_H
#define ABSTRACTTOOLBARMANAGER_H

#include <map>
using namespace std;

#include <QToolBar>
#include <QWidget>

#include <pluginui/pluginui_global.h>

namespace antu
{
namespace plugin
{
namespace ui
{

class PLUGINUISHARED_EXPORT AbstractToolBar
{
    QWidget* m_pWidget;

public:
    AbstractToolBar(QWidget* pWidget);
    virtual ~AbstractToolBar();

    inline QToolBar* toolBar()
    {
        return qobject_cast<QToolBar*>(this->m_pWidget);
    }

    void addWidget(QWidget* pWidget, int stretch = 0);
    virtual void addSeparator() = 0;

protected:
    virtual void appendWidget(QWidget* pWidget, int stretch = 0) = 0;
};

class PLUGINUISHARED_EXPORT AbstractToolBarManager
{
public:
    AbstractToolBarManager();
    virtual ~AbstractToolBarManager();

    AbstractToolBar* toolBar(const QString& name);

private:
    map<QString, AbstractToolBar*> m_oToolBars;

protected:
    virtual AbstractToolBar* createToolBar(const QString& name) = 0;
};
}
}
}
#endif // ABSTRACTTOOLBARMANAGER_H
